;;;
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
;;;	Copyright: 1997-1999
;;;	   Edited: 3-19-99
;;;
(defun c:prjmgmt ( / itsr14)
  (cond
    ((not (null dos_about))T)
    ((=(atoi(substr(getvar"acadver")1 2))12)(xload"doslib12"))
    ((=(atoi(substr(getvar"acadver")1 2))13)(xload"doslib13"nil))
    ((=(atoi(substr(getvar"acadver")1 2))14)(arxload"doslib14")(setq itsr14 T))
    (T(prompt"DOSLib AutoCAD R12, R13 or R14"))
  )
  (IF set_drive_letters NIL (LOAD "set_drive_letters" "\nFile SET_DRIVE_LETTERS.LSP not loaded! "))
  (set_drive_letters)
  (if ustr nil (load"ustr"))
  (setq clientno(atoi(ustr 1 "Client Number"nil nil)))
  (setq projectnum (ustr 1 "Project Number"nil T))
  (if(wcmatch projectnum "* *")
    (setq projectno (substr projectnum 1 (strlen(itoa(read projectnum))))
	  projectfn (substr projectnum (+(strlen projectno)2))
    )
    (setq projectno projectnum
	  projectfn nil
    )
  )
  (setq drivelst(dos_drives))
  (cond
    ((>= clientno 0)
       (if(member work_drive drivelst)
         (progn
           (setq drivestr work_drive)
           (dos_drive drivestr)
           (dos_mkdir (strcat drivestr "\\" (itoa clientno)))
           (dos_mkdir (strcat drivestr "\\" (itoa clientno) "\\" projectno ))
           (dos_mkdir (strcat drivestr "\\" (itoa clientno) "\\" projectno "\\0CAD"))
           (setq new_dir (dos_chdir (strcat drivestr "\\" (itoa clientno) "\\" projectno "\\0CAD")))
           (if new_dir
             (princ (strcat "\nDefault Directory set to " new_dir))
             (princ "\nDefault Directory was not changed! ")
           )
         )
         (progn
           (if itsr14
             (command ".sh" (strcat "net use " work_drive " \\\\Char_nc\\cadd%francishc"))
             (command ".sh" (strcat "use " work_drive " \\\\Char_nc\\cadd%francishc"))
           )
           (setq drivestr work_drive)
           (dos_drive drivestr)
           (dos_mkdir (strcat drivestr "\\" (itoa clientno)))
           (dos_mkdir (strcat drivestr "\\" (itoa clientno) "\\" projectno ))
           (dos_mkdir (strcat drivestr "\\" (itoa clientno) "\\" projectno "\\0CAD"))
           (setq new_dir (dos_chdir (strcat drivestr "\\" (itoa clientno) "\\" projectno "\\0CAD")))
           (if new_dir
             (princ (strcat "\nDefault Directory set to " new_dir))
             (princ "\nDefault Directory was not changed! ")
           )
         )
       )
     )
  )
  (if projectfn
    (setq opnfil (getfiled "Open Drawing" (strcat new_dir projectfn) "DWG" 4))
    (setq opnfil (getfiled "Open Drawing" new_dir "DWG" 4))
  )
;  (if (or(wcmatch opnfil "*.dwg")(wcmatch opnfil "*.DWG"))
;    nil
;    (setq opnfil (strcat opnfil ".DWG"))
;  )
  (if opnfil
    (if (eq(getvar"dbmod")0)
      (command ".open" opnfil)
      (if (or(eq (getvar"dwgname") "STARTUP")(eq (getvar"dwgname") "DRAWING.DWG"))
        (command ".open" "y" opnfil)
        (progn
          (setq save_it (ukword 1 "Save Quit" "The current drawing has been modified.  Save it or Quit?" "Save"))
          (if (eq save_it "Quit")
            (command ".open" "y" opnfil)
            (command ".open" "n" opnfil)
          )
        )
      )
    )
  )
  (princ)
)
  
  
  